package com.example.videodemo;

import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {

    private final static String TAG = "dingfeng";

    ListView listview;

        static String url = "http://live.serve.the9cloud.com/videos/bjn_mm.mp4";
//    static String url = "/storage/emulated/0/DCIM/Camera/VID_20160328_180436.mp4";
//    static String url = "/sdcard/shark.mp4";

    ProgressDialog progressDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        listview = (ListView) findViewById(R.id.listview);

        findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, VideoPlayActivity3.class);
                intent.setData(Uri.parse(url));
                startActivity(intent);
            }
        });

//        listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
//            @Override
//            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//                VideoInfo video = videoList.get(position);
//                String path = video.mPath;
//                Intent intent = new Intent();
//                intent.setClass(MainActivity.this, VideoPlayActivity3.class);
//                intent.setData(Uri.parse(path));
//                intent.putExtra("video_title", video.mName);
//                startActivity(intent);
//            }
//        });

        new GetVideoAsyncTask(this, listview).execute();

    }

}
